home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.1 / perlvar.1 < prev    next >
Text File  |  1995-07-25  |  31KB  |  793 lines

  1.  
  2.  
  3.  
  4.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           perlvar - Perl predefined variables
  10.  
  11.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  12.           PPPPrrrreeeeddddeeeeffffiiiinnnneeeedddd NNNNaaaammmmeeeessss
  13.  
  14.           The following names have special meaning to Perl.  Most of
  15.           the punctuational names have reasonable mnemonics, or
  16.           analogues in one of the shells.  Nevertheless, if you wish
  17.           to use the long variable names, you just need to say
  18.  
  19.               use English;
  20.  
  21.           at the top of your program.  This will alias all the short
  22.           names to the long names in the current package.  Some of
  23.           them even have medium names, generally borrowed from aaaawwwwkkkk.
  24.  
  25.           To go a step further, those variables that depend on the
  26.           currently selected filehandle may instead be set by calling
  27.           an object method on the FileHandle object.  (Summary lines
  28.           below for this contain the word HANDLE.)  First you must say
  29.  
  30.               use FileHandle;
  31.  
  32.           after which you may use either
  33.  
  34.               method HANDLE EXPR
  35.  
  36.           or
  37.  
  38.               HANDLE->method(EXPR)
  39.  
  40.           Each of the methods returns the old value of the FileHandle
  41.           attribute.  The methods each take an optional EXPR, which if
  42.           supplied specifies the new value for the FileHandle
  43.           attribute in question.  If not supplied, most of the methods
  44.           do nothing to the current value, except for _a_u_t_o_f_l_u_s_h(),
  45.           which will assume a 1 for you, just to be different.
  46.  
  47.           A few of these variables are considered "read-only".  This
  48.           means that if you try to assign to this variable, either
  49.           directly or indirectly through a reference.  If you attempt
  50.           to do so, you'll raise a run-time exception.
  51.  
  52.           $ARG
  53.  
  54.           $_      The default input and pattern-searching space.  The
  55.                   following pairs are equivalent:
  56.  
  57.                       while (<>) {...}    # only equivalent in while!
  58.                       while ($_ = <>) {...}
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 6/30/95)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  71.  
  72.  
  73.  
  74.                       /^Subject:/
  75.                       $_ =~ /^Subject:/
  76.  
  77.                       tr/a-z/A-Z/
  78.                       $_ =~ tr/a-z/A-Z/
  79.  
  80.                       chop
  81.                       chop($_)
  82.  
  83.                   (Mnemonic: underline is understood in certain
  84.                   operations.)
  85.  
  86.           $<_d_i_g_i_t>
  87.                   Contains the subpattern from the corresponding set
  88.                   of parentheses in the last pattern matched, not
  89.                   counting patterns matched in nested blocks that have
  90.                   been exited already.  (Mnemonic: like \digit.) These
  91.                   variables are all read-only.
  92.  
  93.           $MATCH
  94.  
  95.           $&      The string matched by the last successful pattern
  96.                   match (not counting any matches hidden within a
  97.                   BLOCK or _e_v_a_l() enclosed by the current BLOCK).
  98.                   (Mnemonic: like & in some editors.)  This variable
  99.                   is read-only.
  100.  
  101.           $PREMATCH
  102.  
  103.           $`      The string preceding whatever was matched by the
  104.                   last successful pattern match (not counting any
  105.                   matches hidden within a BLOCK or eval enclosed by
  106.                   the current BLOCK).  (Mnemonic: ` often precedes a
  107.                   quoted string.)  This variable is read-only.
  108.  
  109.           $POSTMATCH
  110.  
  111.           $'      The string following whatever was matched by the
  112.                   last successful pattern match (not counting any
  113.                   matches hidden within a BLOCK or _e_v_a_l() enclosed by
  114.                   the current BLOCK).  (Mnemonic: ' often follows a
  115.                   quoted string.)  Example:
  116.  
  117.                       $_ = 'abcdefghi';
  118.                       /def/;
  119.                       print "$`:$&:$'\n";         # prints abc:def:ghi
  120.  
  121.                   This variable is read-only.
  122.  
  123.           $LAST_PAREN_MATCH
  124.  
  125.  
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 6/30/95)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  137.  
  138.  
  139.  
  140.           $+      The last bracket matched by the last search pattern.
  141.                   This is useful if you don't know which of a set of
  142.                   alternative patterns matched.  For example:
  143.  
  144.                       /Version: (.*)|Revision: (.*)/ && ($rev = $+);
  145.  
  146.                   (Mnemonic: be positive and forward looking.) This
  147.                   variable is read-only.
  148.  
  149.           $MULTILINE_MATCHING
  150.  
  151.           $*      Set to 1 to do multiline matching within a string, 0
  152.                   to tell Perl that it can assume that strings contain
  153.                   a single line, for the purpose of optimizing pattern
  154.                   matches.  Pattern matches on strings containing
  155.                   multiple newlines can produce confusing results when
  156.                   "$*" is 0.  Default is 0.  (Mnemonic: * matches
  157.                   multiple things.)  Note that this variable only
  158.                   influences the interpretation of "^" and "$".  A
  159.                   literal newline can be searched for even when $* ==
  160.                   0.
  161.  
  162.                   Use of "$*" is deprecated in Perl 5.
  163.  
  164.           input_line_number HANDLE EXPR
  165.  
  166.           $INPUT_LINE_NUMBER
  167.  
  168.           $NR
  169.  
  170.           $.      The current input line number of the last filehandle
  171.                   that was read.  This variable should be considered
  172.                   read-only. Remember that only an explicit close on
  173.                   the filehandle resets the line number.  Since "<>"
  174.                   never does an explicit close, line numbers increase
  175.                   across ARGV files (but see examples under _e_o_f()).
  176.                   (Mnemonic: many programs use "." to mean the current
  177.                   line number.)
  178.  
  179.           input_record_separator HANDLE EXPR
  180.  
  181.           $INPUT_RECORD_SEPARATOR
  182.  
  183.           $RS
  184.  
  185.           $/      The input record separator, newline by default.
  186.                   Works like aaaawwwwkkkk's RS variable, including treating
  187.                   blank lines as delimiters if set to the null string.
  188.                   You may set it to a multicharacter string to match a
  189.                   multi-character delimiter.  Note that setting it to
  190.                   "\n\n" means something slightly different than
  191.                   setting it to "", if the file contains consecutive
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 6/30/95)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  203.  
  204.  
  205.  
  206.                   blank lines.  Setting it to "" will treat two or
  207.                   more consecutive blank lines as a single blank line.
  208.                   Setting it to "\n\n" will blindly assume that the
  209.                   next input character belongs to the next paragraph,
  210.                   even if it's a newline.  (Mnemonic: / is used to
  211.                   delimit line boundaries when quoting poetry.)
  212.  
  213.                       undef $/;
  214.                       $_ = <FH>;          # whole file now here
  215.                       s/\n[ \t]+/ /g;
  216.  
  217.  
  218.           autoflush HANDLE EXPR
  219.  
  220.           $OUTPUT_AUTOFLUSH
  221.  
  222.           $|      If set to nonzero, forces a flush after every write
  223.                   or print on the currently selected output channel.
  224.                   Default is 0.  Note that STDOUT will typically be
  225.                   line buffered if output is to the terminal and block
  226.                   buffered otherwise.  Setting this variable is useful
  227.                   primarily when you are outputting to a pipe, such as
  228.                   when you are running a Perl script under rsh and
  229.                   want to see the output as it's happening.
  230.                   (Mnemonic: when you want your pipes to be piping
  231.                   hot.)
  232.  
  233.           output_field_separator HANDLE EXPR
  234.  
  235.           $OUTPUT_FIELD_SEPARATOR
  236.  
  237.           $OFS
  238.  
  239.           $,      The output field separator for the print operator.
  240.                   Ordinarily the print operator simply prints out the
  241.                   comma separated fields you specify.  In order to get
  242.                   behavior more like aaaawwwwkkkk, set this variable as you
  243.                   would set aaaawwwwkkkk's OFS variable to specify what is
  244.                   printed between fields.  (Mnemonic: what is printed
  245.                   when there is a , in your print statement.)
  246.  
  247.           output_record_separator HANDLE EXPR
  248.  
  249.           $OUTPUT_RECORD_SEPARATOR
  250.  
  251.           $ORS
  252.  
  253.           $\      The output record separator for the print operator.
  254.                   Ordinarily the print operator simply prints out the
  255.                   comma separated fields you specify, with no trailing
  256.                   newline or record separator assumed.  In order to
  257.                   get behavior more like aaaawwwwkkkk, set this variable as you
  258.  
  259.  
  260.  
  261.      Page 4                                          (printed 6/30/95)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  269.  
  270.  
  271.  
  272.                   would set aaaawwwwkkkk's ORS variable to specify what is
  273.                   printed at the end of the print.  (Mnemonic: you set
  274.                   "$\" instead of adding \n at the end of the print.
  275.                   Also, it's just like /, but it's what you get "back"
  276.                   from Perl.)
  277.  
  278.           $LIST_SEPARATOR
  279.  
  280.           $
  281.           This is like "$," except that it applies to array values
  282.           interpolated into a double-quoted string (or similar
  283.           interpreted string).  Default is a space.  (Mnemonic:
  284.           obvious, I think.)
  285.  
  286.           $SUBSCRIPT_SEPARATOR
  287.  
  288.           $SUBSEP
  289.  
  290.           $;      The subscript separator for multi-dimensional array
  291.                   emulation.  If you refer to a hash element as
  292.  
  293.                       $foo{$a,$b,$c}
  294.  
  295.                   it really means
  296.  
  297.                       $foo{join($;, $a, $b, $c)}
  298.  
  299.                   But don't put
  300.  
  301.                       @foo{$a,$b,$c}      # a slice--note the @
  302.  
  303.                   which means
  304.  
  305.                       ($foo{$a},$foo{$b},$foo{$c})
  306.  
  307.                   Default is "\034", the same as SUBSEP in aaaawwwwkkkk.  Note
  308.                   that if your keys contain binary data there might
  309.                   not be any safe value for "$;".  (Mnemonic: comma
  310.                   (the syntactic subscript separator) is a semi-
  311.                   semicolon.  Yeah, I know, it's pretty lame, but "$,"
  312.                   is already taken for something more important.)
  313.  
  314.                   Consider using "real" multi-dimensional arrays in
  315.                   Perl 5.
  316.  
  317.           $OFMT
  318.  
  319.           $#      The output format for printed numbers.  This
  320.                   variable is a half-hearted attempt to emulate aaaawwwwkkkk's
  321.                   OFMT variable.  There are times, however, when aaaawwwwkkkk
  322.                   and Perl have differing notions of what is in fact
  323.                   numeric.  Also, the initial value is %.20g rather
  324.  
  325.  
  326.  
  327.      Page 5                                          (printed 6/30/95)
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  335.  
  336.  
  337.  
  338.                   than %.6g, so you need to set "$#" explicitly to get
  339.                   aaaawwwwkkkk's value.  (Mnemonic: # is the number sign.)
  340.  
  341.                   Use of "$#" is deprecated in Perl 5.
  342.  
  343.           format_page_number HANDLE EXPR
  344.  
  345.           $FORMAT_PAGE_NUMBER
  346.  
  347.           $%      The current page number of the currently selected
  348.                   output channel.  (Mnemonic: % is page number in
  349.                   nnnnrrrrooooffffffff.)
  350.  
  351.           format_lines_per_page HANDLE EXPR
  352.  
  353.           $FORMAT_LINES_PER_PAGE
  354.  
  355.           $=      The current page length (printable lines) of the
  356.                   currently selected output channel.  Default is 60.
  357.                   (Mnemonic: = has horizontal lines.)
  358.  
  359.           format_lines_left HANDLE EXPR
  360.  
  361.           $FORMAT_LINES_LEFT
  362.  
  363.           $-      The number of lines left on the page of the
  364.                   currently selected output channel.  (Mnemonic:
  365.                   lines_on_page - lines_printed.)
  366.  
  367.           format_name HANDLE EXPR
  368.  
  369.           $FORMAT_NAME
  370.  
  371.           $~      The name of the current report format for the
  372.                   currently selected output channel.  Default is name
  373.                   of the filehandle.  (Mnemonic: brother to "$^".)
  374.  
  375.           format_top_name HANDLE EXPR
  376.  
  377.           $FORMAT_TOP_NAME
  378.  
  379.           $^      The name of the current top-of-page format for the
  380.                   currently selected output channel.  Default is name
  381.                   of the filehandle with _TOP appended.  (Mnemonic:
  382.                   points to top of page.)
  383.  
  384.           format_line_break_characters HANDLE EXPR
  385.  
  386.           $FORMAT_LINE_BREAK_CHARACTERS
  387.  
  388.           $:      The current set of characters after which a string
  389.                   may be broken to fill continuation fields (starting
  390.  
  391.  
  392.  
  393.      Page 6                                          (printed 6/30/95)
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  401.  
  402.  
  403.  
  404.                   with ^) in a format.  Default is " \n-", to break on
  405.                   whitespace or hyphens.  (Mnemonic: a "colon" in
  406.                   poetry is a part of a line.)
  407.  
  408.           format_formfeed HANDLE EXPR
  409.  
  410.           $FORMAT_FORMFEED
  411.  
  412.           $^L     What formats output to perform a formfeed.  Default
  413.                   is \f.
  414.  
  415.           $ACCUMULATOR
  416.  
  417.           $^A     The current value of the _w_r_i_t_e() accumulator for
  418.                   _f_o_r_m_a_t() lines.  A format contains _f_o_r_m_l_i_n_e()
  419.                   commands that put their result into $^A.  After
  420.                   calling its format, _w_r_i_t_e() prints out the contents
  421.                   of $^A and empties.  So you never actually see the
  422.                   contents of $^A unless you call _f_o_r_m_l_i_n_e() yourself
  423.                   and then look at it.  See the _p_e_r_l_f_o_r_m manpage and
  424.                   the formline() entry in the _p_e_r_l_f_u_n_c manpage.
  425.  
  426.           $CHILD_ERROR
  427.  
  428.           $?      The status returned by the last pipe close, backtick
  429.                   (``) command, or _s_y_s_t_e_m() operator.  Note that this
  430.                   is the status word returned by the _w_a_i_t() system
  431.                   call, so the exit value of the subprocess is
  432.                   actually ($? >> 8).  Thus on many systems, $? & 255
  433.                   gives which signal, if any, the process died from,
  434.                   and whether there was a core dump.  (Mnemonic:
  435.                   similar to sssshhhh and kkkksssshhhh.)
  436.  
  437.           $OS_ERROR
  438.  
  439.           $ERRNO
  440.  
  441.           $!      If used in a numeric context, yields the current
  442.                   value of errno, with all the usual caveats.  (This
  443.                   means that you shouldn't depend on the value of "$!"
  444.                   to be anything in particular unless you've gotten a
  445.                   specific error return indicating a system error.)
  446.                   If used in a string context, yields the
  447.                   corresponding system error string.  You can assign
  448.                   to "$!" in order to set _e_r_r_n_o if, for instance, you
  449.                   want "$!" to return the string for error _n, or you
  450.                   want to set the exit value for the _d_i_e() operator.
  451.                   (Mnemonic: What just went bang?)
  452.  
  453.           $EVAL_ERROR
  454.  
  455.  
  456.  
  457.  
  458.  
  459.      Page 7                                          (printed 6/30/95)
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  467.  
  468.  
  469.  
  470.           $@      The Perl syntax error message from the last _e_v_a_l()
  471.                   command.  If null, the last _e_v_a_l() parsed and
  472.                   executed correctly (although the operations you
  473.                   invoked may have failed in the normal fashion).
  474.                   (Mnemonic: Where was the syntax error "at"?)
  475.  
  476.           $PROCESS_ID
  477.  
  478.           $PID
  479.  
  480.           $$      The process number of the Perl running this script.
  481.                   (Mnemonic: same as shells.)
  482.  
  483.           $REAL_USER_ID
  484.  
  485.           $UID
  486.  
  487.           $<      The real uid of this process.  (Mnemonic: it's the
  488.                   uid you came _F_R_O_M, if you're running setuid.)
  489.  
  490.           $EFFECTIVE_USER_ID
  491.  
  492.           $EUID
  493.  
  494.           $>      The effective uid of this process.  Example:
  495.  
  496.                       $< = $>;            # set real to effective uid
  497.                       ($<,$>) = ($>,$<);  # swap real and effective uid
  498.  
  499.                   (Mnemonic: it's the uid you went _T_O, if you're
  500.                   running setuid.)  Note: "$<" and "$>" can only be
  501.                   swapped on machines supporting _s_e_t_r_e_u_i_d().
  502.  
  503.           $REAL_GROUP_ID
  504.  
  505.           $GID
  506.  
  507.           $(      The real gid of this process.  If you are on a
  508.                   machine that supports membership in multiple groups
  509.                   simultaneously, gives a space separated list of
  510.                   groups you are in.  The first number is the one
  511.                   returned by _g_e_t_g_i_d(), and the subsequent ones by
  512.                   _g_e_t_g_r_o_u_p_s(), one of which may be the same as the
  513.                   first number.  (Mnemonic: parentheses are used to
  514.                   _G_R_O_U_P things.  The real gid is the group you _L_E_F_T,
  515.                   if you're running setgid.)
  516.  
  517.           $EFFECTIVE_GROUP_ID
  518.  
  519.           $EGID
  520.  
  521.  
  522.  
  523.  
  524.  
  525.      Page 8                                          (printed 6/30/95)
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  533.  
  534.  
  535.  
  536.           $)      The effective gid of this process.  If you are on a
  537.                   machine that supports membership in multiple groups
  538.                   simultaneously, gives a space separated list of
  539.                   groups you are in.  The first number is the one
  540.                   returned by _g_e_t_e_g_i_d(), and the subsequent ones by
  541.                   _g_e_t_g_r_o_u_p_s(), one of which may be the same as the
  542.                   first number.  (Mnemonic: parentheses are used to
  543.                   _G_R_O_U_P things.  The effective gid is the group that's
  544.                   _R_I_G_H_T for you, if you're running setgid.)
  545.  
  546.                   Note: "$<", "$>", "$(" and "$)" can only be set on
  547.                   machines that support the corresponding
  548.                   _s_e_t[_r_e][_u_g]_i_d() routine.  "$(" and "$)" can only be
  549.                   swapped on machines supporting _s_e_t_r_e_g_i_d().
  550.  
  551.           $PROGRAM_NAME
  552.  
  553.           $0      Contains the name of the file containing the Perl
  554.                   script being executed.  Assigning to "$0" modifies
  555.                   the argument area that the _p_s(1) program sees.  This
  556.                   is more useful as a way of indicating the current
  557.                   program state than it is for hiding the program
  558.                   you're running.  (Mnemonic: same as sssshhhh and kkkksssshhhh.)
  559.  
  560.           $[      The index of the first element in an array, and of
  561.                   the first character in a substring.  Default is 0,
  562.                   but you could set it to 1 to make Perl behave more
  563.                   like aaaawwwwkkkk (or Fortran) when subscripting and when
  564.                   evaluating the _i_n_d_e_x() and _s_u_b_s_t_r() functions.
  565.                   (Mnemonic: [ begins subscripts.)
  566.  
  567.                   As of Perl 5, assignment to "$[" is treated as a
  568.                   compiler directive, and cannot influence the
  569.                   behavior of any other file.  Its use is discouraged.
  570.  
  571.           $PERL_VERSION
  572.  
  573.           $]      The string printed out when you say perl -v.  It can
  574.                   be used to determine at the beginning of a script
  575.                   whether the perl interpreter executing the script is
  576.                   in the right range of versions.  If used in a
  577.                   numeric context, returns the version + patchlevel /
  578.                   1000.  Example:
  579.  
  580.                       # see if getc is available
  581.                       ($version,$patchlevel) =
  582.                                $] =~ /(\d+\.\d+).*\nPatch level: (\d+)/;
  583.                       print STDERR "(No filename completion available.)\n"
  584.                                if $version * 1000 + $patchlevel < 2016;
  585.  
  586.                   or, used numerically,
  587.  
  588.  
  589.  
  590.  
  591.      Page 9                                          (printed 6/30/95)
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  599.  
  600.  
  601.  
  602.                       warn "No checksumming!\n" if $] < 3.019;
  603.  
  604.                   (Mnemonic: Is this version of perl in the right
  605.                   bracket?)
  606.  
  607.           $DEBUGGING
  608.  
  609.           $^D     The current value of the debugging flags.
  610.                   (Mnemonic: value of ----DDDD switch.)
  611.  
  612.           $SYSTEM_FD_MAX
  613.  
  614.           $^F     The maximum system file descriptor, ordinarily 2.
  615.                   System file descriptors are passed to _e_x_e_c()ed
  616.                   processes, while higher file descriptors are not.
  617.                   Also, during an _o_p_e_n(), system file descriptors are
  618.                   preserved even if the _o_p_e_n() fails.  (Ordinary file
  619.                   descriptors are closed before the _o_p_e_n() is
  620.                   attempted.)  Note that the close-on-exec status of a
  621.                   file descriptor will be decided according to the
  622.                   value of $^F at the time of the open, not the time
  623.                   of the exec.
  624.  
  625.           $INPLACE_EDIT
  626.  
  627.           $^I     The current value of the inplace-edit extension.
  628.                   Use undef to disable inplace editing.  (Mnemonic:
  629.                   value of ----iiii switch.)
  630.  
  631.           $PERLDB
  632.  
  633.           $^P     The internal flag that the debugger clears so that
  634.                   it doesn't debug itself.  You could conceivable
  635.                   disable debugging yourself by clearing it.
  636.  
  637.           $BASETIME
  638.  
  639.           $^T     The time at which the script began running, in
  640.                   seconds since the epoch (beginning of 1970).  The
  641.                   values returned by the ----MMMM, ----AAAA and ----CCCC filetests are
  642.                   based on this value.
  643.  
  644.           $WARNING
  645.  
  646.           $^W     The current value of the warning switch, either TRUE
  647.                   or FALSE.  (Mnemonic: related to the ----wwww switch.)
  648.  
  649.           $EXECUTABLE_NAME
  650.  
  651.           $^X     The name that the Perl binary itself was executed
  652.                   as, from C's argv[0].
  653.  
  654.  
  655.  
  656.  
  657.      Page 10                                         (printed 6/30/95)
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  665.  
  666.  
  667.  
  668.           $ARGV   contains the name of the current file when reading
  669.                   from <>.
  670.  
  671.           @ARGV   The array @ARGV contains the command line arguments
  672.                   intended for the script.  Note that $#ARGV is the
  673.                   generally number of arguments minus one, since
  674.                   $ARGV[0] is the first argument, _N_O_T the command
  675.                   name.  See "$0" for the command name.
  676.  
  677.           @INC    The array @INC contains the list of places to look
  678.                   for Perl scripts to be evaluated by the do EXPR,
  679.                   require, or use constructs.  It initially consists
  680.                   of the arguments to any ----IIII command line switches,
  681.                   followed by the default Perl library, probably
  682.                   "/usr/local/lib/perl", followed by ".", to represent
  683.                   the current directory.
  684.  
  685.           %INC    The hash %INC contains entries for each filename
  686.                   that has been included via do or require.  The key
  687.                   is the filename you specified, and the value is the
  688.                   location of the file actually found.  The require
  689.                   command uses this array to determine whether a given
  690.                   file has already been included.
  691.  
  692.           $ENV{expr}
  693.                   The hash %ENV contains your current environment.
  694.                   Setting a value in ENV changes the environment for
  695.                   child processes.
  696.  
  697.           $SIG{expr}
  698.                   The hash %SIG is used to set signal handlers for
  699.                   various signals.  Example:
  700.  
  701.                       sub handler {       # 1st argument is signal name
  702.                           local($sig) = @_;
  703.                           print "Caught a SIG$sig--shutting down\n";
  704.                           close(LOG);
  705.                           exit(0);
  706.                       }
  707.  
  708.                       $SIG{'INT'} = 'handler';
  709.                       $SIG{'QUIT'} = 'handler';
  710.                       ...
  711.                       $SIG{'INT'} = 'DEFAULT';    # restore default action
  712.                       $SIG{'QUIT'} = 'IGNORE';    # ignore SIGQUIT
  713.  
  714.                   The %SIG array only contains values for the signals
  715.                   actually set within the Perl script.  Here are some
  716.                   other examples:
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.      Page 11                                         (printed 6/30/95)
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730.      PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))  UUUUNNNNIIIIXXXX SSSSyyyysssstttteeeemmmm VVVV ((((RRRReeeelllleeeeaaaasssseeee 0000....0000 PPPPaaaattttcccchhhhlllleeeevvvveeeellll 00000000))))  PPPPEEEERRRRLLLLVVVVAAAARRRR((((1111))))
  731.  
  732.  
  733.  
  734.                       $SIG{PIPE} = Plumber;       # SCARY!!
  735.                       $SIG{"PIPE"} = "Plumber";   # just fine, assumes main::Plumber
  736.                       $SIG{"PIPE"} = \&Plumber;   # just fine; assume current Plumber
  737.                       $SIG{"PIPE"} = Plumber();   # oops, what did Plumber() return??
  738.  
  739.                   The one marked scary is problematic because it's a
  740.                   bareword, which means sometimes it's a string
  741.                   representing the function, and sometimes it's going
  742.                   to call the subroutine call right then and there!
  743.                   Best to be sure and quote it or take a reference to
  744.                   it.  *Plumber works too.  See <perlsubs>.
  745.  
  746.  
  747.  
  748.  
  749.  
  750.  
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.      Page 12                                         (printed 6/30/95)
  790.  
  791.  
  792.  
  793.